package com.gson;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;



/**
 * 服务响应
 * @author hewenhui
 * @date 2018年3月8日
 */
public class ServiceResponse implements Serializable{

	private static final long serialVersionUID = -885151682463012042L;
	//响应代码
	private String respCode;
	//响应消息
	private String respMsg;
	//服务器IP
	private final String serverIp;
	//响应时间
	private long respTime;
	//响应结果
	private Map<String, Object> result;
	
	public static ServiceResponse newInstance() {
		return new ServiceResponse();
	}
	
	public Map<String, Object> getResult() {
		return result;
	}

	public void setRespTime(long respTime) {
		this.respTime = respTime;
	}

	private ServiceResponse() {
		result = new HashMap<String, Object>();
		serverIp = HostUtil.getHostIp();
	}

	public String getRespCode() {
		return respCode;
	}

	public void setRespCode(String respCode) {
		this.respCode = respCode;
	}

	public String getRespMsg() {
		return respMsg;
	}

	public void setRespMsg(String respMsg) {
		this.respMsg = respMsg;
	}

	public String getServerIp() {
		return serverIp;
	}

	public long getRespTime() {
		return respTime;
	}

	public Object getResultValue(String attribute) {
		return result.get(attribute);
	}

	public void setResultValue(String attribute, Object value) {
		this.result.put(attribute, value);
	}
	
}
